package cn.bone.hystrix;

import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;

/**
 * Created by MD-01 on 2017/3/28.
 */
public class HelloHystrixCommand extends HystrixCommand<String>{

    private String someBody;

    protected HelloHystrixCommand(String someBody) {
        super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("hello")));
        this.someBody = someBody;
    }

    @Override
    protected String run() throws Exception {
        //生产环境中此处为第三方依赖的具体调用逻辑
        return new StringBuilder().append("Hello ").append(someBody).toString();
    }
}
